"use strict";
cc._RF.push(module, '7f99f8EnqtMipynqE5W7+Nk', 'GoldSpawn');
// Script/produce/GoldSpawn.ts

Object.defineProperty(exports, "__esModule", { value: true });
var Constant_1 = require("../constant/Constant");
var startGame_1 = require("../gameSwitch/startGame");
// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var NewClass = /** @class */ (function (_super) {
    __extends(NewClass, _super);
    function NewClass() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.eventSys = null;
        _this.goldNode = null;
        return _this;
        // update (dt) {}
    }
    // LIFE-CYCLE CALLBACKS:
    // onLoad () {}
    NewClass.prototype.start = function () {
        var t = this;
        t.goldNode = cc.find("RandomGold", t.node);
        cc.director.getScheduler().schedule(function () {
            var gaming = t.eventSys.getComponent(startGame_1.default).gaming;
            if (gaming) {
                var mark = Math.random() > 0.5 ? -1 : 1;
                t.goldNode.x = mark * (Math.random() * Constant_1.Constant.SCREEN.width / 2);
                t.goldNode.active = true;
            }
        }, this, 5);
    };
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "eventSys", void 0);
    NewClass = __decorate([
        ccclass
    ], NewClass);
    return NewClass;
}(cc.Component));
exports.default = NewClass;

cc._RF.pop();